﻿@using Entity
@model List<Entity.Alert>
@{
    ViewBag.Title = "Dashboard";
}

<div class="row">
    <div class="col-xs-12">
        <div class="box">
            <div class="box-header">
                <h3 class="box-title">Messages</h3>
            </div>
            <!-- /.box-header -->
            <div class="box-body table-responsive">
                <table id="example2" class="table table-bordered table-hover">
                    <thead>
                        <tr>
                            <th>Message
                            </th>
                            <th>Type
                            </th>
                            <th style="width: 150px">Action
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var item in Model)
                        {
                            <tr>
                                <td>
                                    @item.Message
                                </td>
                                @switch (item.TypeId)
                                {
                                    case (int)AlertType.AssignTask:
                                    <td>Assign Task
                                    </td>
                                        break;
                                    case (int)AlertType.Comment:
                                    <td>Comment
                                    </td>
                                        break;
                                    case (int)AlertType.Event:
                                    <td>Event
                                    </td>
                                        break;
                                    case (int)AlertType.Report:
                                    <td>Report
                                    </td>
                                        break;
                                    case (int)AlertType.Task:
                                    <td>Task
                                    </td>
                                        break;
                                }

                                <td>
                                    @*@Html.ActionLink("Sửa", "Edit", new {id = item.Id}, new {@class ="btn btn-default btn-flat"})*@ 
                                    @Html.ActionLink("Delete", "Delete", new {id = item.Id}, new {@class ="btn btn-default btn-flat"})
                                    <a class="btn btn-default btn-flat" href="@Url.Action("Detail", new { referenceId = item.ReferenceId, typeId = item.TypeId, id = item.Id })"><i class="fa fa-caret-right"></i>Display</a>
                                </td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
            <!-- /.box-body -->
        </div>
        <!-- /.box -->
    </div>
</div>
@section Script
{
    <script type="text/javascript">
        $(function () {
            $('#example2').dataTable({
                "bPaginate": true,
                "bLengthChange": false,
                "bFilter": false,
                "bSort": false,
                "bInfo": true,
                "bAutoWidth": false,
                "aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "Tất cả"]],
                "iDisplayLength": 25,
            });
        });
    </script>
}

<input type="hidden" class="uploadFile" value="1,2,3" id="upload"/>